﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using ScrobbleItSL.Data;
using ScrobbleItSL.LastFmApi;

namespace ScrobbleItSL.Models
{
    public class UserModel : IUserModel
    {
        public UserModel():this(new User())
        {
        }

        public UserModel(User user)
        {
            this.User = user;
        }

        public User User { get; set; }

        public event EventHandler<UserEventArgs> UserAuthenticated;
        public event EventHandler<LastFmErrorEventArgs> AuthenticationFailed;
        public void OnUserAuthenticated()
        {
            if (UserAuthenticated!=null)
                UserAuthenticated(this, new UserEventArgs(User));
        }

        public void OnAuthenticationFailed(LastFmErrorEventArgs eventArgs)
        {
            if (AuthenticationFailed!=null)
            {
                AuthenticationFailed(this, eventArgs);
            }
        }
    }
}
